package com.example.zhu.mapper;

import com.example.zhu.entity.Coupon;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface CouponMapper {
    @Select("select * from coupon where name like concat('%',#{name},'%')")
    List<Coupon> selectByName(String name);

    @Select("select * from coupon")
    List<Coupon> selectAll();

    @Select("select * from coupon where id = #{id}")
    List<Coupon> selectById(Integer id);

    @Delete("delete from coupon_book where openid = #{openid}")
    void deleteByOpenid(String openid);

    @Select("select * from coupon where id = #{couponId}")
    Coupon selectByCouponId(Integer couponId);
}
